#include "SchmidtCAM.h"

int main( int argc, char *argv[] ){

    printf("> (ads5294_sync) start syncing ADS5294 ...\n");

    int fd = open("/dev/mem", O_RDWR | O_SYNC);
    uint *ptr1 = mmap(NULL, 10, PROT_READ | PROT_WRITE, MAP_SHARED, fd, ADDR_GPIO_OUT);
    uint *gpio_reg      = ptr1;     // 0x41200000

    clrbit(*gpio_reg, BIT_ADS5294_SYNC);

    printf("> (ads5294_sync) pull-up SYNC.\n");
    setbit(*gpio_reg, BIT_ADS5294_SYNC);
    
    usleep(1);

    clrbit(*gpio_reg, BIT_ADS5294_SYNC);
    printf("> (ads5294_sync) pull-down SYNC.\n");

    munmap(ptr1,10);
    close(fd);

    printf("> (ads5294_sync) finished syncing ADS5294 ...\n");

    return 0;
}
